#define _CRT_SECURE_NO_WARNINGS 1


#include<vector>
#include<stack>
#include<iostream>

using namespace std;

bool IsPopOrder(vector<int>& pushV, vector<int>& popV)
{
    stack<int> st;
    int cur = 0;
    for (int i = 0; i < pushV.size(); i++)
    {
        st.push(pushV[i]);
        while (cur < popV.size() && !st.empty() && st.top() == popV[cur])
        {
            st.pop();
            cur++;
        }
    }
    return st.empty();
}

int main()
{
    vector<int> v1 = { 2,1,0 };
    vector<int> v2 = { 1,2,0 };
    cout << IsPopOrder(v1, v2) << endl;

	return 0;
}